<template>
  <span>{{result}}</span>
</template>

<script>
export default {
 props: {
  list: {
    type: Array,
    default: () => []
  },
  label: {
    type: String,
    default: 'label'
  },
  value: {
    type: String,
    default: 'value'
  },
  dictCode: {}
 },
  computed: {
    result() {
      if(this.dictCode && this.list.length> 0) {
        let obj = this.list.filter(item => item[this.value] === this.dictCode)[0];
        if(obj) {
          return obj[this.label];
        } else {
          return this.dictCode || "";
        }
      }
    }
  }
}
</script>

<style>

</style>
